home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 July / EnigmA AMIGA RUN 20 (1997)(G.R. Edizioni)(IT)[!][issue 1997-07 & 08][EAR-CD IV].iso / recent1 / wwwcount2.3src.lha / wwwcount2.3 / Count-config < prev    next >
Text File  |  1996-05-03  |  11KB  |  439 lines

  1. #!/bin/sh
  2. ###
  3. # $Revision: 2.3 $
  4. # $Date: 1996/05/03 02:20:22 $
  5. #
  6. # Configure script for Count 1.2
  7. # muquit@semcor.com
  8. # November 23, 1995
  9. #
  10. # This script generates the following files from user input
  11. #   config.h
  12. #   Makefile
  13. #   combine/Makefile
  14. #
  15. # wrote this script with bash functions, then realized it will  not be very
  16. # portable.. rewrote: Nov 25, 1995
  17. #
  18. ###
  19.  
  20. trap 'echo '';echo "Interrupt Detected..exiting";rm -f "./Config.tmpl" 2>/dev/null;rm -f "./.alfcf" ;rm -f "./strict" 2>/dev/null;echo '';exit 1' 1 2 3 15
  21.  
  22. Tmpl="./Config.tmpl"
  23. CgiBinDir="/usr/local/etc/httpd/cgi-bin"
  24.  
  25. if [ ! -f "./VERSION" ] 
  26. then
  27. cat << EOV
  28.  
  29.         The file ./VERSION does not exist!
  30.         aborting!
  31.  
  32. EOV
  33.         exit 1
  34. fi
  35.  
  36. Version=`cat ./VERSION`
  37. Basedir="wwwcount$Version"
  38. ConfigH="config.h"
  39. BaseDir="/usr/local/etc/Counter"
  40. ConfigDir="conf"
  41. ConfFile="count.cfg"
  42. DigitDir="digits"
  43. DataDir="data"
  44. LogDir="Log"
  45. LogFile="Count$Version.log"
  46. RgbFile="./wcount/rgb.txt"
  47. #allow_f_cr=0
  48. #strict_mode=0
  49.  
  50. (echo "hi there\c" ; echo " ") >.echotest
  51. if grep c .echotest >/dev/null 2>&1 ; then
  52. n='-n'
  53. c=''
  54. else
  55. n=''
  56. c='\c'
  57. fi
  58. rm -f .echotest >/dev/null 2>&1
  59.  
  60. Pwd=`pwd`
  61. checkbd=`basename $Pwd`
  62.  
  63. ###
  64. # check if we'r inside valid directory
  65.     if [ $checkbd != $Basedir ]
  66.     then
  67. cat << EOR2
  68.  
  69. ************************************************************************
  70.     Your current working directory must be $Basedir 
  71.     in order configure the counter!
  72.     Wrong current working directory: $checkbd
  73. ************************************************************************
  74.  
  75. EOR2
  76.     exit 2
  77.     fi
  78.  
  79.  
  80. ##
  81. # cleanup
  82. ###
  83. if [ -f "./config.h" ]
  84. then
  85.     rm -f "./config.h"
  86. fi
  87.  
  88. ##
  89. # initial screeen
  90. ###
  91. cat << EOSI
  92.     Welcome to the configuration procedure of Count $Version
  93.     ---------------------------------------------------
  94.  
  95.     o You must know where your system keeps CGI programs (cgi-bin directory)
  96.       It is necessary to generate the install program.
  97.       This directory must exist. If this directory does not exist, the
  98.       configuration procedure will Abort!
  99.  
  100.     o You have to decide a directory, where you will keep all counter related
  101.       stuff. This directory will have other directories inside. Default
  102.       values will be supplied, press Return key to accept the default value.
  103.       Accept the default value, it will make your life much easier.
  104.  
  105.     During installation, the directories will be created for you
  106.     if they do not exist and if you have the permission to do so.
  107.     ++
  108. EOSI
  109.  
  110.  
  111. ###
  112. echo $n "Continue [y|n]$c? "
  113. read answer
  114.  
  115. if [ .$answer = . ]
  116. then
  117.     answer=x
  118. fi
  119.     until [ $answer = "y" -o $answer = "Y" -o $answer = "n" -o $answer = "N" ]
  120.     do
  121.         echo $n "Continue [y|n]$c? "
  122.         read answer
  123.             if [ .$answer = . ]
  124.             then
  125.                 answer=x
  126.             fi
  127.     done
  128.  
  129.     case $answer in
  130.         y|Y)
  131. ####################
  132. # Ask for cgi-bin     --starts
  133. ###
  134. cat <<EOB
  135.  
  136.     You need to enter the full path of the directory where you system
  137.     keeps the CGI programs. This directory must exist!
  138.  
  139. EOB
  140. echo $n "*cgi-bin dierctory [$CgiBinDir]:$c "
  141. read newpath
  142. if [ .$newpath != . ]
  143. then
  144.     CgiBinDir=$newpath
  145. fi
  146. # check if the directory exist
  147. if [ ! -d $CgiBinDir ]
  148. then
  149. cat <<EOCG  
  150.  
  151.     Directory "$CgiBinDir" does not exist! If you do not know where your
  152.     system keeps CGI programs, find it out first. If you did not configure
  153.     your http server yet, please do so and come back!
  154.  
  155.     Aborting configuration procedure!
  156.  
  157. EOCG
  158.     exit 2
  159. fi
  160.  
  161. ####################
  162. # Ask for cgi-bin     --ends
  163. ###
  164. ####################
  165. # Ask for basedir     --starts
  166. ###
  167. cat <<EOB
  168.  
  169.     You need to enter the base directory of the counter related stuff.
  170.  
  171. EOB
  172. echo $n "*Base directory [$BaseDir]:$c "
  173. read newpath
  174. if [ .$newpath != . ]
  175. then
  176.     BaseDir=$newpath
  177. fi
  178.  
  179. ####################
  180. # Ask for basedir     --ends
  181. ###
  182. ####################
  183. # Ask for configdir     --starts
  184. ###
  185. cat <<EOB
  186.  
  187.     You need to enter the directory of the configuration file.
  188.  
  189. EOB
  190. echo $n "* Config directory [$BaseDir/$ConfigDir]:$c "
  191. read newpath
  192. if [ .$newpath != . ]
  193. then
  194.     ConfigDir=$newpath
  195. fi
  196. ####################
  197. # Ask for configdir     --ends
  198. ###
  199. ####################
  200. # Ask for configfile     --starts
  201. ###
  202. cat <<EOB
  203.  
  204.     You need to enter the name of the configuration file.
  205.     This file contains the information about
  206.  
  207.         o if you want to ignore access from certain hosts
  208.         o host acccess authentication
  209.  
  210.     You will create this file later by running the program "Gen_conf".
  211.  
  212. EOB
  213. echo $n "* Name of the configuration file [$ConfFile]:$c "
  214. read newpath
  215. if [ .$newpath != . ]
  216. then
  217.     ConfFile=$newpath
  218. fi
  219. ####################
  220. # Ask for configfile     --end
  221. ###
  222. ####################
  223. # Ask for datadir     --starts
  224. ###
  225. cat <<EOB
  226.               
  227.     You need to enter the directory of the counter data file.
  228.     
  229. EOB
  230. echo $n "*Data directory [$BaseDir/$DataDir]:$c "
  231. read newpath
  232. if [ .$newpath != . ]
  233. then
  234.     DataDir=$newpath
  235. fi  
  236. ####################
  237. # Ask for datadir     --ends
  238. ###
  239.  
  240. ####################
  241. # Ask for logdir     --starts
  242. ###
  243. cat <<EOB   
  244.  
  245.     You need to enter the directory of the Log file.
  246.  
  247. EOB
  248. echo $n "*Log directory [$BaseDir/$LogDir]:$c "
  249. read newpath
  250. if [ .$newpath != . ]
  251. then
  252.     LogDir=$newpath
  253. fi
  254. ####################
  255. # Ask for logdir     --ends
  256. ###
  257. ####################
  258. # Ask for logfile     --starts
  259. ###
  260. cat <<EOB
  261.  
  262.     You need to enter the name of the Log file.
  263.     This file hold the error messages of the counter. It also
  264.     logs if someone tried to access your counter remotely.
  265.  
  266. EOB
  267. echo $n "* Name of the log file [$LogFile]:$c "
  268. read newpath
  269. if [ .$newpath != . ]
  270. then
  271.     LogFile=$newpath
  272. fi
  273. ####################
  274. # Ask for logfile     --ends
  275. ###
  276.         ;;
  277.         n|N)
  278.             echo "Exiting..Better luck next time!"
  279.             exit 1
  280.         ;;
  281.  
  282.         *)
  283.             echo ""
  284.             echo "Illegal choice"
  285.      esac
  286.  
  287. echo ""
  288. echo "You entered:"
  289. echo "++++++++++++++++++++++++++++++"
  290.     echo "CgiBinDir=$CgiBinDir"
  291.     echo "BaseDir= $BaseDir"
  292.     echo "DigitDir= $BaseDir/$DigitDir"
  293.     echo "ConfDir = $BaseDir/$ConfigDir"
  294.     echo "ConfFile= $ConfFile"
  295.     echo "DataDir= $BaseDir/$DataDir"
  296.     echo "LogDir= $BaseDir/$LogDir"
  297.     echo "LogFile= $LogFile"
  298. echo "++++++++++++++++++++++++++++++"
  299.  
  300. echo $n "Everything looks ok [y|n]$c? "
  301. read answer
  302.  
  303. if [ .$answer = . ]
  304. then
  305.     answer=x
  306. fi
  307.     until [ $answer = "y" -o $answer = "Y" -o $answer = "n" -o $answer = "N" ]
  308.     do
  309.         echo $n "Everything looks ok [y|n]$c? "
  310.         read answer
  311.             if [ .$answer = . ]
  312.             then
  313.                 answer=x
  314.             fi
  315.     done
  316.  
  317.     case $answer in
  318.         y|Y)
  319.         echo "Great! creating header file $ConfigH"
  320. ###
  321. # create header file --starts
  322. ###
  323. d=`date`
  324. cat <<EOH>$ConfigH
  325. #ifndef _COUNT_CONFIG_H
  326. #define _COUNT_CONFIG_H 1
  327.  
  328. /*
  329. ** This file is automatically generated by the Configure script 
  330. ** Count-config written by muquit@semcor.com
  331. ** Counter Version: $Version
  332. ** created on: $d
  333. **
  334. **  If you edit this file, you better make sure you know what are 
  335. **  you doing.
  336. */
  337. EOH
  338. echo "#define ConfigDir \"$BaseDir/$ConfigDir\"" >> $ConfigH
  339. echo "#define ConfigFile \"$ConfFile\"" >> $ConfigH
  340. echo "#define DataDir \"$BaseDir/$DataDir\"" >> $ConfigH
  341. echo "#define DigitDir \"$BaseDir/$DigitDir\"" >> $ConfigH
  342. echo "#define LogDir \"$BaseDir/$LogDir\"" >> $ConfigH
  343. echo "#define LogFile \"$LogFile\"" >> $ConfigH
  344.  
  345. cat<<EOX>>$ConfigH
  346.  
  347. /*****************************************************************************
  348. * Defaults parameters not supplied in calling.
  349. * Change 'em here if you insist...
  350. *****************************************************************************/
  351. #define DefaultMaxDigits       6      /* Max digits in output        */
  352. #define DefaultLeftpad         True   /* 0 indicates no padding      */
  353.  
  354. #define DefaultThickness       6       /* 0 indicates no frame        */
  355. #define Default_FrameRed       100
  356. #define DefaultFrameGreen      139      /* RGB=0;0;0 for black         */
  357. #define DefaultFrameBlue       216
  358. #define FRGB_ImpliedFt         5       /* Use this FT if we get FRGB only */
  359.  
  360. #define DefaultTransparency       False    /* 0 indicates no transparent  */
  361. #define DefaultTransparentRed     0
  362. #define DefaultTransparentGreen   0 /* RGB=255;255;255 for white   */
  363. #define DefaultTransparentBlue    0
  364. #define TRGBImpliedTr              1   /* Use this TR if we get TRRBG only */
  365.  
  366. #define DefaultStartCount          1      /* Initial counter value       */
  367. #define DefaultShowCount           1      /* 1 indicates count is shown  */
  368. #define DfForRandom            "RANDOM"    /* This DF name means use rand */
  369. #define DefaultDatafile        "RANDOM"    /* Make rand the default, too  */
  370.  
  371. #define DefaultDigitsStyle       "A" /* Use GIFs in digits/A/files  */
  372. #define ParamDelimiters           "|&"    /* These separate params       */
  373.  
  374. /*****************************************************************************
  375. * This specifies a file listing RGB values mapped to names.
  376. * If not defined, no attempt to use RGB names is made.  If you're not sure,   
  377. * just leave this be--it's okay if the file does not exist.
  378. *
  379. * When RGB_MAPPING_ISERROR is set to 1, an error is returned when RGB name
  380. * value is used, but it shows the corresponding RGB triplet.  This is done
  381. * so RGB names can be looked up, but yet not allow users to make constant
  382. * use of this very ineffiecient lookup.
  383. *****************************************************************************/
  384. #define RgbMappingDict        "$BaseDir/rgb.txt"
  385. EOX
  386.  
  387. #if [ $allow_f_cr -eq 1 ]
  388. #then
  389. #echo "#define ALLOW_FILE_CREATION   1" >>$ConfigH
  390. #else
  391. #echo "#define ALLOW_FILE_CREATION   0" >>$ConfigH
  392. #fi
  393.  
  394. #if [ $strict_mode -eq 1 ]
  395. #then
  396. #echo "#define STRICT_MODE   1" >>$ConfigH
  397. #else
  398. #echo "#define STRICT_MODE   0" >>$ConfigH
  399. #fi
  400.  
  401. cat<<EOXXX>>$ConfigH
  402. /*****************************************************************************
  403. * End of parameter defaults
  404. *****************************************************************************/
  405. #endif /* _COUNT_CONFIG_H*/
  406. EOXXX
  407.  
  408. ###
  409. # create header file --ends
  410. ###
  411. ##
  412. # create template for install program --starts
  413. ##
  414. echo "creating variables template file $Tmpl for the install program.."
  415. echo "BASE_DIR=\"$BaseDir\"" > $Tmpl
  416. echo "CGIBIN_DIR=\"$CgiBinDir\"" >> $Tmpl
  417. echo "CONFIG_FILE=\"$ConfFile\"" >> $Tmpl
  418. echo "CONFIG_DIR=\"$BaseDir/$ConfigDir\"" >> $Tmpl
  419. echo "DIGIT_DIR=\"$BaseDir/$DigitDir\"" >> $Tmpl
  420. echo "DATA_DIR=\"$BaseDir/$DataDir\"" >> $Tmpl
  421. echo "LOG_DIR=\"$BaseDir/$LogDir\"" >> $Tmpl
  422. echo "LOG_FILE=\"$LogFile\"" >> $Tmpl
  423. echo "RGB_FILE=\"$RgbFile\"" >> $Tmpl
  424. echo "RGB_DIR=\"$BaseDir\"" >> $Tmpl
  425. ##
  426. # create template for install program --ends
  427. ##
  428. echo "now run ./configure"
  429.         ;;
  430.         n|N)
  431.             echo "Exiting..Better luck next time!"
  432.         ;;
  433.  
  434.         *)
  435.             echo ""
  436.             echo "Illegal choice"
  437.      esac
  438. # End of configuration script
  439.